<?php
// 本类由系统自动生成，仅供测试用途
class VoteAction extends Action {
   

    public function index(){
    	$Category = M("Category");
    	$list = $Category -> limit(10) ->order('id desc') ->select();
    	//var_dump($list); 
    	$this->assign('category_list',$list);
	 	$this->display();
    }

    public function add(){
    	
	 	$this->display();
    }

    public function insert(){
		$Category =M("Category");
		$vo["title"]=$_POST["category_title"];
		//$vo["status"]=$_POST["category_status"];
		// $vo["domain"]=$_POST["domain"];
		//var_dump($vo); 
			if ($status = $Category->add($vo)) {
            $vo = $Category->add();
            if ($status !== false) {
            	//$this->success('用户添加成功！');
            	$data['statusCode'] = '200';
				$data['message'] = '新增成功！';
				$data['navTabId'] = 'vote';
				$data['forwardUrl'] = '';
				$data['callbackType'] = 'closeCurrent';
				$this->ajaxReturn($data,'JSON');

 				//$this->ajaxReturn($result,"新增成功！",1);

      //  	 echo '<script type="text/javascript">
					 //  {
					 // "statusCode":"200",
				 	// "message":"操作成功",
						// "navTabId":"",
					 // 	"forwardUrl":"",
					 // 	"callbackType":"closeCurrent"
					 // };
				  //   </script>';
            } else {
                $this->error ('新增失败!','admin.php?s=Index/add_category');
            }
        } else {
            $this->error($Category->getError());
        }
        
	}
}